package 集合进阶.综合练习;

import java.util.ArrayList;
import java.util.Collections;

public class 自动点名器2 {
    public static void main(String[] args) {
       /* 班级里有N个学生
        要求：
        70%的概率随机到男生
        30%的概率随机到女生

        "范闲","范建","范统","杜子腾","宋合泛","侯笼藤","朱益群","朱穆朗玛峰",
        "杜琦燕","袁明媛","李猜","田蜜蜜",
        */

        //1.定义一个存储男生和女生的集合
        ArrayList<String> manList=new ArrayList<>();
        ArrayList<String> girlList=new ArrayList<>();

        //2.添加数据
        Collections.addAll(manList,"范闲","范建","范统","杜子腾","宋合泛","侯笼藤","朱益群","朱穆朗玛峰");
        Collections.addAll(girlList, "杜琦燕","袁明媛","李猜","田蜜蜜");

        //3.定义一个概率的集合-----1:男生, 0女生
        ArrayList<Integer> num=new ArrayList<>();
        Collections.addAll(num,1,1,1,1,1,1,1,0,0,0);
        //打乱集合
        Collections.shuffle(num);
        //获取打乱后的值
        Integer integer = num.get(0);
        if (integer==0){
            Collections.shuffle(manList);
            System.out.println(manList.get(0));
        }else {
            Collections.shuffle(girlList);
            System.out.println(girlList.get(0));
        }
    }
}
